<!doctype html>
<head>
	<meta http-equiv="Content-type" content="text/html; charset=utf-8">
	<title>Cell mode</title>
</head>
	<script src='../../codebase/dhtmlxscheduler.js' type="text/javascript" charset="utf-8"></script>
	<script src='../../codebase/ext/dhtmlxscheduler_timeline.js' type="text/javascript" charset="utf-8"></script>
	
	<link rel='stylesheet' type='text/css' href='../../codebase/dhtmlxscheduler.css'>
	
<style type="text/css" media="screen">
	html, body{
		margin:0px;
		padding:0px;
		height:100%;
		overflow:hidden;
	}	
	.white_cell{
		background-color:white;
	}
	.green_cell{
		background-color:#95FF95;
	}
	.yellow_cell{
		background-color:#FFFF79;
	}
	.red_cell{
		background-color:#FF5353;
	}
</style>

<script type="text/javascript" charset="utf-8">
	function init() {

		scheduler.locale.labels.matrix_tab = "Matrix"
		scheduler.locale.labels.section_custom="Section";
		scheduler.config.details_on_create=true;
		scheduler.config.details_on_dblclick=true;
		scheduler.config.xml_date="%Y-%m-%d %H:%i";
		scheduler.config.multi_day = true;
		brief_mode = true; 
		
		
		//===============
		//Configuration
		//===============
		var sections=[
			{key:1, label:"Section A"},
			{key:2, label:"Section B"},
			{key:3, label:"Section C"},
			{key:4, label:"Section D"}
		];
		
		scheduler.createTimelineView({
			name:	"matrix",
			x_unit:	"day",
			x_date:	"%d %M",
			x_step:	1,
			x_size: 15,
			y_unit:	sections,
			y_property:	"section_id"
		});
		
		//===============
		//Customization
		//===============
		scheduler.templates.matrix_cell_class = function(evs,x,y){
			if (!evs) {
				var day = x.getDay();
				return (day==0 || day == 6) ? "yellow_cell" : "white_cell";
			}
			if (evs.length<3) return "green_cell";
			if (evs.length<5) return "yellow_cell";
			return "red_cell";
		};

		scheduler.templates.matrix_scalex_class = function(date){
			if (date.getDay()==0 || date.getDay()==6)  return "yellow_cell";
			return "";
		}
		
	
		//===============
		//Data loading
		//===============
		scheduler.config.lightbox.sections=[	
			{name:"description", height:130, map_to:"text", type:"textarea" , focus:true},
			{name:"custom", height:23, type:"select", options:sections, map_to:"section_id" },
			{name:"time", height:72, type:"time", map_to:"auto"}
		]
		
		scheduler.init('scheduler_here',new Date(2009,5,30),"matrix");
		scheduler.load("./data/units.xml");
	}
</script>

<body onload="init();">
	<div id="scheduler_here" class="dhx_cal_container" style='width:100%; height:100%;'>
		<div class="dhx_cal_navline">
			<div class="dhx_cal_prev_button">&nbsp;</div>
			<div class="dhx_cal_next_button">&nbsp;</div>
			<div class="dhx_cal_today_button"></div>
			<div class="dhx_cal_date"></div>
			<div class="dhx_cal_tab" name="day_tab" style="right:204px;"></div>
			<div class="dhx_cal_tab" name="week_tab" style="right:140px;"></div>
			<div class="dhx_cal_tab" name="matrix_tab" style="right:280px;"></div>
			<div class="dhx_cal_tab" name="month_tab" style="right:76px;"></div>
		</div>
		<div class="dhx_cal_header">
		</div>
		<div class="dhx_cal_data">
		</div>		
	</div>
</body>